package com.oig.sys.auth.constants;

/**
 * auth服务枚举类
 * 可能其他模块会用，先放pojo里
 */
public class AuthEnums {
    private AuthEnums(){}

    /**
     * 数据隔离范围
     */
    public enum DataScope{
        PUB("1","不隔离"),
        TAN("2","租户隔离"),
        ;
        private final String code;
        private final String name;

        public String getCode() {
            return code;
        }
        public String getName() {
            return name;
        }

        DataScope(String code, String name){
            this.code = code;
            this.name = name;
        }
        public static boolean validCode(String code) {
            for (DataScope enumItems : DataScope.values()) {
                if (enumItems.getCode().equals(code)) {
                    return true;
                }
            }
            return false;
        }
    }


    public enum AlignEnum{
        ALIGN_LEFT("0","左对齐"),
        ALIGN_CENTER("1","居中对齐"),
        ALIGN_RIGHT("2","右对齐"),
        ;
        private final String code;
        private final String name;

        public String getCode() {
            return code;
        }
        public String getName() {
            return name;
        }

        AlignEnum(String code, String name){
            this.code = code;
            this.name = name;
        }


        public static boolean validCode(String code) {
            for (AlignEnum enumItems : AlignEnum.values()) {
                if (enumItems.getCode().equals(code)) {
                    return true;
                }
            }
            return false;
        }
    }

    /**
     * 列值类型：0-数值（浮点数+整数）1-整数  2-字符串 3-日期 4-日期时间 5-时间 6-枚举 7-枚举数组 当枚举时enum_value_json有值
     */
    public enum ValueType{
        NUMBER("0","数值"),
        INT("1","整数"),
        STR("2","字符串"),
        DATE("3","日期"),
        DATE_TIME("4","日期时间"),
        TIME("5","时间"),
        ENUM("6","枚举"),
        ENUM_ARR("7","枚举数组"),
        FILE_N("8","文件"),
        LINK("9","外链"),
        ;
        private final String code;
        private final String name;

        public String getCode() {
            return code;
        }
        public String getName() {
            return name;
        }

        ValueType(String code, String name){
            this.code = code;
            this.name = name;
        }

        public static boolean validCode(String code) {
            for (ValueType enumItems : ValueType.values()) {
                if (enumItems.getCode().equals(code)) {
                    return true;
                }
            }
            return false;
        }
    }

    /**
     * 列查询组件类型：0-文本 1-between  2-枚举下拉框 3-查询下拉框 4-弹框查询 5-树形下拉
     * =1时 取enum_value_json值获取枚举 2~3默认支持多选
     */
    public enum QueryType{
        TXT("0","文本"),
        BWT("1","between"),
        SEL_ENUM("2","枚举下拉框"),
        SEL_QUERY("3","查询下拉框"),
        SEL_MD_QUERY("4","弹框查询"),
        SEL_TREE("5","树形下拉"),
        ;
        private final String code;
        private final String name;

        public String getCode() {
            return code;
        }
        public String getName() {
            return name;
        }

        QueryType(String code, String name){
            this.code = code;
            this.name = name;
        }

        public static boolean validCode(String code) {
            for (QueryType enumItems : QueryType.values()) {
                if (enumItems.getCode().equals(code)) {
                    return true;
                }
            }
            return false;
        }
    }

    /**
     * 应用类型
     */
    public enum SystemTypeEnum{
        SYSTEM_IN("0","内部应用"),
        SYSTEM_APP("1","手机app"),
        SYSTEM_OUT("2","外部应用"),
        /**
         * 公共应用 不配置权限
         */
        SYSTEM_PUB("3","公共应用"),
        ;
        private final String code;
        private final String name;

        public String getCode() {
            return code;
        }
        public String getName() {
            return name;
        }

        SystemTypeEnum(String code, String name){
            this.code = code;
            this.name = name;
        }

        public static boolean validCode(String code) {
            for (SystemTypeEnum enumItems : SystemTypeEnum.values()) {
                if (enumItems.getCode().equals(code)) {
                    return true;
                }
            }
            return false;
        }
    }


    public enum DataCfgUserLimitType{
        ROLE("0","角色"),
        JOB("1","岗位"),
        DEPART("2", "部门"),
        ;
        private final String code;
        private final String name;

        public String getCode() {
            return code;
        }
        public String getName() {
            return name;
        }

        DataCfgUserLimitType(String code, String name){
            this.code = code;
            this.name = name;
        }

        /** 判断参数合法性 */
        public static boolean validCode(String code) {
            for (DataCfgUserLimitType enumItems : DataCfgUserLimitType.values()) {
                if (enumItems.getCode().equals(code)) {
                    return true;
                }
            }
            return false;
        }
    }

    public enum DataCfgEqType{
        USERID("0","用户id"),
        FIXED("1","固定值"),
        OTHER("9","自定义sql"),//暂时不支持
        ;
        private final String code;
        private final String name;

        public String getCode() {
            return code;
        }
        public String getName() {
            return name;
        }

        DataCfgEqType(String code, String name){
            this.code = code;
            this.name = name;
        }

        public static boolean validCode(String code) {
            for (DataCfgEqType enumItems : DataCfgEqType.values()) {
                if (enumItems.getCode().equals(code)) {
                    return true;
                }
            }
            return false;
        }
    }


    public enum AuthType{
        FS("1","飞书"),
        RA("2","内部单点"),
        ;
        private final String code;
        private final String name;

        public String getCode() {
            return code;
        }
        public String getName() {
            return name;
        }
        AuthType(String code, String name){
            this.code = code;
            this.name = name;
        }
    }


    public enum TerminalType{
        PC("1","PC"),
        PH("2","手机"),
        ;
        private final String code;
        private final String name;

        public String getCode() {
            return code;
        }
        public String getName() {
            return name;
        }
        TerminalType(String code, String name){
            this.code = code;
            this.name = name;
        }
    }

}
